﻿using System;
using System.Collections.Generic;
using System.Text;
using BBMS.DLL.Base;
namespace BBMS.DLL.DataContract
{
    public class ChungTuBase : ObjectBase
    {
        public long ID = 0;
        public string LoaiCT = "";
        public string MaCT = "";
        public string SoCT = "";
        public DateTime NgayCT;
        public DateTime NgayHT;
        public DateTime NgayTTDuKien;
        public string MaHoSo;
        public string MaNCC;
        public string MaQuay;
        public string MaCTyThuHo;
        public DateTime NgayTT;
        public TrangThaiThanhToan TrangThaiTT;
        public long GiaTriHangHoa;
        public long ChietKhau;
        public long GiaTriChuaThue;
        public int ThueSuat;
        public long GiaTriThue;
        public long GiaTriCT;
        public long GiaTriDaTT;
        public string ChungTuGoc;
        public bool CoHoaDon;
        public bool IsChi;
        public string GhiChu;
        public int NVID;


        public ChungTuBase()
        {
        }

        public ChungTuBase(long id, string loaiCT, string maCT, string soCT,
            DateTime ngayCT, DateTime ngayHT, DateTime ngayTTDuKien, 
            DateTime ngayTT, TrangThaiThanhToan trangThaiTT, 
            string maSoHS, string maNCC, string maQuay, string maCTyThuHo,
            long giatriHangHoa, long chietKhau,
            long giaTriChuaThue, int thueSuat, long giaTriThue,
            long giaTriCT, long giaTriDaTT, string ctGoc, bool coHoaDon, bool isChi, string ghiChu,
            int nvID)
        {
            this.ID = id;
            this.LoaiCT = loaiCT;
            this.MaCT = maCT;
            this.SoCT = soCT;

            this.NgayCT = ngayCT;
            this.NgayHT = ngayHT;
            this.NgayTTDuKien = ngayTTDuKien;

            this.NgayTT = ngayTT;
            this.TrangThaiTT = trangThaiTT;
            
            this.MaHoSo = maSoHS;
            this.MaNCC = maNCC;
            this.MaQuay = maQuay;
            this.MaCTyThuHo = maCTyThuHo;
            
            this.GiaTriHangHoa = giatriHangHoa;
            this.ChietKhau = chietKhau;
            
            this.GiaTriChuaThue = giaTriChuaThue;
            this.ThueSuat = thueSuat;
            this.GiaTriThue = giaTriThue;

            this.GiaTriCT = giaTriCT;
            this.GiaTriDaTT = giaTriDaTT;
            this.ChungTuGoc = ctGoc;
            this.CoHoaDon = coHoaDon;
            this.IsChi = isChi;
            this.GhiChu = ghiChu;

            this.NVID = nvID;
        }

        public override bool CanDelete(MySql.Data.MySqlClient.MySqlCommand cmd, System.Data.DataRow row)
        {
            return base.CanDelete(cmd, row);
        }

        public override string TableName
        {
            get
            {
                return "bill";
            }
        }
        public override object Key
        {
            get
            {
                return this.ID;
            }
        }
        public override string[] KeyFields
        {
            get
            {
                return new string[] {"MaCT","SoCT"};
            }
        }

        public override string[]  IDFields
        {
	        get 
	        { 
		         return new string[] {"ID"};
	        }
        }

        public override string ExWhereClause
        {
            get
            {
                return string.Format(" LoaiCT = '{0}' ", this.LoaiCT);
            }
        }

        public override string Name
        {
            get
            {
                return string.Format("{0}-{1}-{2}",LoaiCT,MaCT,SoCT);
            }
        }
    }
}
